import 'package:get/get.dart';
import 'package:native_dart_package/http/request/exception/exception_handler.dart';
import 'package:native_dart_package/loading/loading_util.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:yt_devops/pages/mine/message_center/advertise_message/advertise_message_detail/advertise_message_detail_model.dart';
import 'package:yt_devops/services/messsage/message_services.dart';

class AdvertiseMessageDetailController extends GetxController {
  RefreshController refreshcontroller = RefreshController();
  final MessageServices messageServices = Get.put(MessageServices());
  AdvertiseMessageDetailState advertiseDetailModel =
      AdvertiseMessageDetailState();

  @override
  void onInit() {
    super.onInit();
    getAnnouncementDetails();
  }

  void getAnnouncementDetails() async {
    var params = {'noticeId': Get.arguments['noticeId']};
    await messageServices.getAnnouncementDetail(params, onError: (err) {
      handleException(err);
      return false;
    }).then((value) {
      advertiseDetailModel = AdvertiseMessageDetailState.fromJson(value);
      update();
    });
  }
}
